<template>
  <div class="page-content padding-top">
    <list class="von-checkbox">
      <item class="item-icon-right" v-for="(item,index) in name" @click.native="selectItem(item,index)">
        {{item}}<i :class="{'icon ion-ios-checkmark-empty assertive':ind == index}"></i>
      </item>
    </list>
  </div>
</template>
<script>
import { bus } from 'bus.js'
  export default {
    data() {
      return {
        arr:[],
        name:[],
        value:[],
        ind:null,
      }
    },
    created(){
      var _this = this;
      axios.get(baseUrl+'/controller/getRegionList',{params:{
          marketId:sess.get('userSession').marketId
        }
      })
      .then(function(res){
        _this.arr = res.data.result;
        for (var i = 0; i < _this.arr.length; i++) {
          _this.name.push(_this.arr[i].regionName);
          _this.value.push(_this.arr[i].regionId);
        }
      })
    },
    methods: {
      selectItem(a,i){
        this.ind = i;
        bus.$emit('region', this.value[i]);
        bus.$emit('regionName', a);
      }
    }
  }
</script>

